package com.yc.demo.QueryBooks;

import com.google.gson.Gson;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "QueryBookServlet", value = "/QueryBookServlet.s")
public class QueryBookServlet extends HttpServlet {
    BookDao dao = new BookDao();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String name = request.getParameter("name");
        String press = request.getParameter("press");
        String date = request.getParameter("date");
        String json = new Gson().toJson(dao.queryBook(name,press,date));
        response.getWriter().append(json);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
